﻿using System;
using System.IO;

namespace IceDog.SmallProject.ImageHexStringConvert
{
    class Program
    {
        static void Main(string[] args)
        {
            var filePath = "test-file/tz.jpg";
#if DEBUG
            filePath = "../../../" + filePath;
#endif
            var bytes = File.ReadAllBytes(filePath);
            var hexContents = ImgTxtConvert.ConvertToHexString(bytes);
            if (!Directory.Exists("dist"))
            {
                Directory.CreateDirectory("dist");
            }
            File.WriteAllText("dist/hexImg.txt", hexContents);
            File.WriteAllText("dist/bytesImg.txt", string.Join("", bytes));

            var hexStr = File.ReadAllText("dist/hexImg.txt");
            var bytesContents = ImgTxtConvert.ConvertToBytes(hexStr);
            File.WriteAllBytes("dist/restoreImg.jpg", bytesContents);
        }
    }
}
